<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<script type="text/javascript">
$(document).ready(function() { 
        $("#usersTable").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the secound column (we start counting zero) 
            0: { 
                // disable it by setting the property sorter to false 
                sorter: false,
                width: '10px'
            }
        }
    }); 
    } 
);

function checkSetAll(value, name) {
	var objs = document.getElementsByName('selectedUsers');
	for (var i = 0; i < objs.length; i++) {
		objs[i].checked = value;
	}
}
</script> 
<div>
<s:form action="/galleries/Advertise.action" method="POST">
	<s:hidden name="mode" value="ADD"></s:hidden>
	<s:hidden name="galleryId"></s:hidden>
	<table> 
		<tr>
			<td class="title" colspan="2"><s:text name="advert.add.title" /></td>
		</tr>
		<tr>
			<td><s:textarea key="advert.add.text" name="text" cols="30" rows="5"></s:textarea></td>
		</tr>
		<tr>
			<td colspan="2">
				<table id="usersTable" class="tablesorter" > 
					<thead> 
						<tr> 
						    <th style="width: 16px;">&nbsp;</th> 
						    <th><s:text name="user.list.userId"></s:text></th> 
						    <th><s:text name="user.list.userName"></s:text></th>
						</tr> 
					</thead>
					<tbody>
						<s:iterator id="user" value="users">
							<tr>
								<td>
									<s:if test="%{!#user.userId.equals(#session.session_user.userId)}" >
										<input type="checkbox" name="selectedUsers" 
											value="<s:property id="user" value="userId"/>">
									</s:if>
									<s:else></s:else>
								</td>
								<td>
									<s:property id="user" value="userId" default=" -none- "/>
								</td>
								<td>
									<s:property id="user" value="userName" default=" - "/>
								</td>
							</tr>
						</s:iterator>
					</tbody>
				</table>
			</td>
		</tr>
		<tr>	
			<td colspan="2">
				<s:submit cssClass="action" key="advert.add.save"/>
			</td>
		</tr>
	</table>
</s:form>
</div>